/*
 * @Description: 
 * @Author: baimenghan
 * @Email: baimenghan@nnuo.com
 * @Date: 2022-02-25 09:23:10
 * @LastEditors: baimenghan
 * @LastEditTime: 2022-02-25 15:53:35
 * @FilePath: \daka\src\request\index.js
 */
import axios from 'axios';

const instance = axios.create({
    baseURL: '/daka/v1/',
    timeout: 5000
})

instance.interceptors.request.use(config => {
    return config;
}, error => {
    return Promise.reject(error);
})

instance.interceptors.response.use(response => {
    return response;
}, error => {
    return Promise.reject(error);
})

const request = (param) => new Promise((resolve, reject) => {
    instance(param).then(res => {
        resolve(res.data.data);
    }).catch(err => {
        reject(err);
    })
})

export default request;